<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>runtransform</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >MetaGETA (Metadata Gathering, Extraction and Transformation)</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Module&nbsp;runtransform
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="runtransform-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="runtransform-module.html">Module runtransform</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: latin-1 -*-</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># Copyright (c) 2011 Australian Government, Department of Sustainability, Environment, Water, Population and Communities</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># Permission is hereby granted, free of charge, to any person obtaining a copy</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"># of this software and associated documentation files (the "Software"), to deal</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"># in the Software without restriction, including without limitation the rights</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"># to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"># copies of the Software, and to permit persons to whom the Software is</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"># furnished to do so, subject to the following conditions:</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"># The above copyright notice and this permission notice shall be included in</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"># all copies or substantial portions of the Software.</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"># THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"># IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-comment"># FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-comment"># AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-comment"># LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-comment"># OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-comment"># THE SOFTWARE.</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">Metadata Transforms</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">===================</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">Script to run the Metadata Transforms.</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">Contains code to show GUI to gather input arguments when none are provided.</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">To run, call the eponymous batch file which sets the required environment variables.</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">Usage::</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    runtransform.bat -x xls -t xsl -d dir</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">@newfield sysarg: Argument, Arguments</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-x xls}: MS Excel spreadsheet to read from</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-t xsl}: XSL transform - may be one of the pre-defined XSL transforms or a path to a custom XSL file.</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-d dir}: Directory to write XML files to.</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">@note:B{Additional metadata elements}</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">      The ANZLIC ISO19139 stylesheet can make use of additional metadata elements that may be </tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">      manually added to the Excel spreadsheet and will be included in the output XML/MEF metadata.</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">      See the L{transforms} module documentation for more information.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring"> </tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">@todo: Set up logging &amp; debug properly.</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-comment">#Imports</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt><tt class="py-op">,</tt><tt class="py-name">sys</tt><tt class="py-op">,</tt><tt class="py-name">glob</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">Tkinter</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">tkFileDialog</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">Ft</tt><tt class="py-op">.</tt><tt class="py-name">Xml</tt> <tt class="py-keyword">import</tt> <tt class="py-name">Domlette</tt> <tt class="py-keyword">as</tt> <tt class="py-name">Dom</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Module utilities=utilities-module.html"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-0', 'utilities', 'link-0');">utilities</a></tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Package transforms=transforms-module.html,Variable transforms.transforms=transforms-module.html#transforms"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-1', 'transforms', 'link-1');">transforms</a></tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module progresslogger=progresslogger-module.html"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-2', 'progresslogger', 'link-2');">progresslogger</a></tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"> </tt>
<a name="main"></a><div id="main-def"><a name="L56"></a><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-param">xls</tt><tt class="py-op">,</tt><tt class="py-param">xsl</tt><tt class="py-op">,</tt><tt class="py-param">dir</tt><tt class="py-op">,</tt><tt class="py-param">logger</tt><tt class="py-op">,</tt> <tt class="py-param">mef</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-param">cat</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="main-expanded"><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">    <tt class="py-string">'''</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-string">    Run the Metadata Transform</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-string">    @type  xls: C{str}</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-string">    @param xls: Excel spreadsheet to read metadata from</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-string">    @type  xsl: C{str}</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-string">    @param xsl: XSL transform {*.xsl|%s}</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-string">    @type  dir: C{str}</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-string">    @param dir: The directory to output metadata XML to</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-string">    @type  logger: C{progresslogger.ProgressLogger}</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-string">    @param logger: An instantiated logger</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-string">    @type  mef: C{boolean}</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-string">    @param mef: Create Metadata Exchange Format (MEF) file</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-string">    @type  cat: C{str}</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-string">    @param cat: The GeoNetwork category/ies to apply to the records ('|' separated)</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-string"></tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-string">    @todo - start using the "-m" opt, currently not used at all.</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-string">          - add it to the GetArgs GUI</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-string">          - populate a dropdown list with transforms.categories</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-string">          - add a gui event that show/hides or enables/disables the categ list triggered by the mef opt</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-string">          - if &lt;default&gt; categ is selected, logic is:</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-string">            * check xls for categ column</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-string">            * if so use that,</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt class="py-string">            * if categ column is null for a row, of if no column at all then use default from config</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-string">          </tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-string">    '''</tt> <tt class="py-op">%</tt> <tt class="py-string">'|'</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">'"%s"'</tt><tt class="py-op">%</tt><tt id="link-3" class="py-name" targets="Variable transforms.s=transforms-module.html#s"><a title="transforms.s" class="py-name" href="#" onclick="return doclink('link-3', 's', 'link-3');">s</a></tt> <tt class="py-keyword">for</tt> <tt id="link-4" class="py-name"><a title="transforms.s" class="py-name" href="#" onclick="return doclink('link-4', 's', 'link-3');">s</a></tt> <tt class="py-keyword">in</tt> <tt id="link-5" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-5', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-6', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-name">xlrdr</tt><tt class="py-op">=</tt><tt id="link-7" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-7', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Class utilities.ExcelReader=utilities.ExcelReader-class.html"><a title="utilities.ExcelReader" class="py-name" href="#" onclick="return doclink('link-8', 'ExcelReader', 'link-8');">ExcelReader</a></tt><tt class="py-op">(</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt> <tt class="py-name">list</tt><tt class="py-op">)</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">    <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'Transforming %s metadata records'</tt><tt class="py-op">%</tt><tt class="py-name">xlrdr</tt><tt class="py-op">.</tt><tt class="py-name">records</tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">rec</tt> <tt class="py-keyword">in</tt> <tt class="py-name">xlrdr</tt><tt class="py-op">:</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-name">tmpcat</tt><tt class="py-op">=</tt><tt class="py-name">cat</tt> <tt class="py-comment">#dummy var as we may overwrite it</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt id="link-9" class="py-name" targets="Module overviews=overviews-module.html"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-9', 'overviews', 'link-9');">overviews</a></tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">            <tt class="py-name">deleted</tt><tt class="py-op">=</tt><tt class="py-name">False</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt><tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">enumerate</tt><tt class="py-op">(</tt><tt class="py-name">rec</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-comment">#We use a list instead of a dict as there can be multiple fields with the same header/name</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-string">'DELETED'</tt> <tt class="py-keyword">and</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-name">deleted</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-string">'filename'</tt><tt class="py-op">:</tt><tt class="py-name">filename</tt><tt class="py-op">=</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-string">'guid'</tt><tt class="py-op">:</tt><tt class="py-name">guid</tt><tt class="py-op">=</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-string">'quicklook'</tt><tt class="py-op">,</tt><tt class="py-string">'thumbnail'</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-string">''</tt><tt class="py-op">:</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">                    <tt id="link-10" class="py-name"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-10', 'overviews', 'link-9');">overviews</a></tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-string">'category'</tt> <tt class="py-keyword">and</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">                    <tt class="py-name">tmpcat</tt><tt class="py-op">=</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">                    <tt class="py-keyword">del</tt> <tt class="py-name">rec</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-name">xmlfile</tt><tt class="py-op">=</tt><tt class="py-string">'%s/%s.%s.xml'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt><tt class="py-name">guid</tt><tt class="py-op">)</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">            <tt class="py-name">meffile</tt><tt class="py-op">=</tt><tt class="py-string">'%s/%s.%s.mef'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt><tt class="py-name">guid</tt><tt class="py-op">)</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">deleted</tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">                <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'%s has been marked as deleted, XSLT processing will be terminated.'</tt><tt class="py-op">%</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Function utilities.exists()=utilities-module.html#exists"><a title="utilities.exists" class="py-name" href="#" onclick="return doclink('link-11', 'exists', 'link-11');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">xmlfile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rename</tt><tt class="py-op">(</tt><tt class="py-name">xmlfile</tt><tt class="py-op">,</tt><tt class="py-string">'%s.deleted'</tt><tt class="py-op">%</tt><tt class="py-name">xmlfile</tt><tt class="py-op">)</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="utilities.exists" class="py-name" href="#" onclick="return doclink('link-12', 'exists', 'link-11');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">meffile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rename</tt><tt class="py-op">(</tt><tt class="py-name">meffile</tt><tt class="py-op">,</tt><tt class="py-string">'%s.deleted'</tt><tt class="py-op">%</tt><tt class="py-name">meffile</tt><tt class="py-op">)</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">                <tt class="py-keyword">continue</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">            <tt class="py-name">strxml</tt><tt class="py-op">=</tt><tt id="link-13" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-13', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Function transforms.ListToXML()=transforms-module.html#ListToXML"><a title="transforms.ListToXML" class="py-name" href="#" onclick="return doclink('link-14', 'ListToXML', 'link-14');">ListToXML</a></tt><tt class="py-op">(</tt><tt class="py-name">rec</tt><tt class="py-op">,</tt><tt class="py-string">'crawlresult'</tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-15" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-15', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Function transforms.Transform()=transforms-module.html#Transform"><a title="transforms.Transform" class="py-name" href="#" onclick="return doclink('link-16', 'Transform', 'link-16');">Transform</a></tt><tt class="py-op">(</tt><tt class="py-name">strxml</tt><tt class="py-op">,</tt> <tt class="py-name">xsl</tt><tt class="py-op">,</tt> <tt class="py-name">xmlfile</tt><tt class="py-op">)</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">            <tt class="py-comment">#if overviews:transforms.CreateMEF(dir,xmlfile,guid,overviews)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">            <tt class="py-comment">#Create MEF even if there are no overviews</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">mef</tt><tt class="py-op">:</tt><tt id="link-17" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-17', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Function transforms.CreateMEF()=transforms-module.html#CreateMEF"><a title="transforms.CreateMEF" class="py-name" href="#" onclick="return doclink('link-18', 'CreateMEF', 'link-18');">CreateMEF</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">xmlfile</tt><tt class="py-op">,</tt><tt class="py-name">guid</tt><tt class="py-op">,</tt><tt id="link-19" class="py-name"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-19', 'overviews', 'link-9');">overviews</a></tt><tt class="py-op">,</tt><tt class="py-name">tmpcat</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'Transformed metadata for '</tt> <tt class="py-op">+</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">,</tt><tt class="py-name">err</tt><tt class="py-op">:</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">            <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt class="py-name">error</tt><tt class="py-op">(</tt><tt class="py-string">'%s\n%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt id="link-20" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-20', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Function utilities.ExceptionInfo()=utilities-module.html#ExceptionInfo"><a title="utilities.ExceptionInfo" class="py-name" href="#" onclick="return doclink('link-21', 'ExceptionInfo', 'link-21');">ExceptionInfo</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">            <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Variable formats.debug=formats-module.html#debug,Variable geometry.debug=geometry-module.html#debug"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-22', 'debug', 'link-22');">debug</a></tt><tt class="py-op">(</tt><tt id="link-23" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-23', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="utilities.ExceptionInfo" class="py-name" href="#" onclick="return doclink('link-24', 'ExceptionInfo', 'link-21');">ExceptionInfo</a></tt><tt class="py-op">(</tt><tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">remove</tt><tt class="py-op">(</tt><tt class="py-name">xmlfile</tt><tt class="py-op">)</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt><tt class="py-op">:</tt><tt class="py-keyword">pass</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">        <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Method progresslogger.ProgressBarView.updateProgress()=progresslogger.ProgressBarView-class.html#updateProgress,Method progresslogger.ProgressLoggerHandler.updateProgress()=progresslogger.ProgressLoggerHandler-class.html#updateProgress"><a title="progresslogger.ProgressBarView.updateProgress
progresslogger.ProgressLoggerHandler.updateProgress" class="py-name" href="#" onclick="return doclink('link-25', 'updateProgress', 'link-25');">updateProgress</a></tt><tt class="py-op">(</tt><tt class="py-name">xlrdr</tt><tt class="py-op">.</tt><tt class="py-name">records</tt><tt class="py-op">)</tt> </tt>
</div><a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">         </tt>
<a name="exit"></a><div id="exit-def"><a name="L120"></a><tt class="py-lineno">120</tt> <a class="py-toggle" href="#" id="exit-toggle" onclick="return toggle('exit');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#exit">exit</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>  </tt>
</div><a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">    <tt class="py-docstring">'''Force exit after closure of the ProgressBar GUI'''</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-name">exe</tt><tt class="py-op">=</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">splitext</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">basename</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">executable</tt><tt class="py-op">.</tt><tt class="py-name">lower</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">forceexit</tt><tt class="py-op">:</tt>   <tt class="py-comment">#Issue?</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">exe</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-string">'python'</tt><tt class="py-op">,</tt><tt class="py-string">'pythonw'</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-comment">#Little kludge to stop killing dev IDEs</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">            <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">_exit</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
</div><a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line"> </tt>
<a name="showmessage"></a><div id="showmessage-def"><a name="L127"></a><tt class="py-lineno">127</tt> <a class="py-toggle" href="#" id="showmessage-toggle" onclick="return toggle('showmessage');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#showmessage">showmessage</a><tt class="py-op">(</tt><tt class="py-param">title</tt><tt class="py-op">,</tt> <tt class="py-param">msg</tt><tt class="py-op">,</tt><tt class="py-param">type</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="showmessage-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="showmessage-expanded"><a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">Tkinter</tt><tt class="py-op">,</tt><tt class="py-name">tkMessageBox</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-name">tk</tt><tt class="py-op">=</tt><tt class="py-name">Tkinter</tt><tt class="py-op">.</tt><tt class="py-name">Tk</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">    <tt class="py-name">tk</tt><tt class="py-op">.</tt><tt class="py-name">withdraw</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">    <tt class="py-name">val</tt><tt class="py-op">=</tt><tt class="py-name">tkMessageBox</tt><tt class="py-op">.</tt><tt class="py-name">showinfo</tt><tt class="py-op">(</tt><tt class="py-name">title</tt><tt class="py-op">,</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">type</tt><tt class="py-op">=</tt><tt class="py-name">type</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">    <tt class="py-name">tk</tt><tt class="py-op">.</tt><tt class="py-name">destroy</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">val</tt> </tt>
</div><a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"> </tt>
<a name="getlogger"></a><div id="getlogger-def"><a name="L135"></a><tt class="py-lineno">135</tt> <a class="py-toggle" href="#" id="getlogger-toggle" onclick="return toggle('getlogger');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#getlogger">getlogger</a><tt class="py-op">(</tt><tt class="py-param">name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">nogui</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">icon</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="getlogger-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="getlogger-expanded"><a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-26" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-26', 'debug', 'link-22');">debug</a></tt><tt class="py-op">:</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">        <tt class="py-name">level</tt><tt class="py-op">=</tt><tt id="link-27" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-27', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-28" class="py-name" targets="Variable progresslogger.DEBUG=progresslogger-module.html#DEBUG"><a title="progresslogger.DEBUG" class="py-name" href="#" onclick="return doclink('link-28', 'DEBUG', 'link-28');">DEBUG</a></tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">        <tt class="py-name">level</tt><tt class="py-op">=</tt><tt id="link-29" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-29', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-30" class="py-name" targets="Variable progresslogger.INFO=progresslogger-module.html#INFO"><a title="progresslogger.INFO" class="py-name" href="#" onclick="return doclink('link-30', 'INFO', 'link-30');">INFO</a></tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt>   <tt class="py-name">logger</tt> <tt class="py-op">=</tt> <tt id="link-31" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-31', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Class progresslogger.ProgressLogger=progresslogger.ProgressLogger-class.html"><a title="progresslogger.ProgressLogger" class="py-name" href="#" onclick="return doclink('link-32', 'ProgressLogger', 'link-32');">ProgressLogger</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">=</tt><tt class="py-name">name</tt><tt class="py-op">,</tt><tt id="link-33" class="py-name" targets="Variable progresslogger.ProgressLogger.logfile=progresslogger.ProgressLogger-class.html#logfile"><a title="progresslogger.ProgressLogger.logfile" class="py-name" href="#" onclick="return doclink('link-33', 'logfile', 'link-33');">logfile</a></tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">logToConsole</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-name">logToFile</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">logToGUI</tt><tt class="py-op">=</tt><tt class="py-keyword">not</tt> <tt class="py-name">nogui</tt><tt class="py-op">,</tt> <tt class="py-name">level</tt><tt class="py-op">=</tt><tt class="py-name">level</tt><tt class="py-op">,</tt> <tt class="py-name">icon</tt><tt class="py-op">=</tt><tt class="py-name">icon</tt><tt class="py-op">,</tt> <tt id="link-34" class="py-name" targets="Variable getargs.Arg.callback=getargs.Arg-class.html#callback,Variable getargs.GetArgs.callback=getargs.GetArgs-class.html#callback"><a title="getargs.Arg.callback
getargs.GetArgs.callback" class="py-name" href="#" onclick="return doclink('link-34', 'callback', 'link-34');">callback</a></tt><tt class="py-op">=</tt><tt id="link-35" class="py-name" targets="Function runcrawler.exit()=runcrawler-module.html#exit,Function runtransform.exit()=runtransform-module.html#exit"><a title="runcrawler.exit
runtransform.exit" class="py-name" href="#" onclick="return doclink('link-35', 'exit', 'link-35');">exit</a></tt><tt class="py-op">)</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt><tt class="py-op">:</tt><tt class="py-name">logger</tt> <tt class="py-op">=</tt> <tt id="link-36" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-36', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="progresslogger.ProgressLogger" class="py-name" href="#" onclick="return doclink('link-37', 'ProgressLogger', 'link-32');">ProgressLogger</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">=</tt><tt class="py-name">name</tt><tt class="py-op">,</tt><tt id="link-38" class="py-name"><a title="progresslogger.ProgressLogger.logfile" class="py-name" href="#" onclick="return doclink('link-38', 'logfile', 'link-33');">logfile</a></tt><tt class="py-op">=</tt><tt id="link-39" class="py-name"><a title="progresslogger.ProgressLogger.logfile" class="py-name" href="#" onclick="return doclink('link-39', 'logfile', 'link-33');">logfile</a></tt><tt class="py-op">,</tt> <tt class="py-name">logToConsole</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-name">logToFile</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">logToGUI</tt><tt class="py-op">=</tt><tt class="py-keyword">not</tt> <tt class="py-name">nogui</tt><tt class="py-op">,</tt> <tt class="py-name">level</tt><tt class="py-op">=</tt><tt class="py-name">level</tt><tt class="py-op">,</tt> <tt id="link-40" class="py-name"><a title="getargs.Arg.callback
getargs.GetArgs.callback" class="py-name" href="#" onclick="return doclink('link-40', 'callback', 'link-34');">callback</a></tt><tt class="py-op">=</tt><tt id="link-41" class="py-name"><a title="runcrawler.exit
runtransform.exit" class="py-name" href="#" onclick="return doclink('link-41', 'exit', 'link-35');">exit</a></tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">logger</tt> </tt>
</div><a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-comment">#========================================================================================================</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="mefcallback"></a><div id="mefcallback-def"><a name="L146"></a><tt class="py-lineno">146</tt> <a class="py-toggle" href="#" id="mefcallback-toggle" onclick="return toggle('mefcallback');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#mefcallback">mefcallback</a><tt class="py-op">(</tt><tt class="py-param">mefarg</tt><tt class="py-op">,</tt><tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="mefcallback-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mefcallback-expanded"><a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-name">checked</tt><tt class="py-op">=</tt><tt class="py-name">mefarg</tt><tt class="py-op">.</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">arg</tt> <tt class="py-keyword">in</tt> <tt class="py-name">args</tt><tt class="py-op">:</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">            <tt class="py-name">arg</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Variable getargs.Arg.enabled=getargs.Arg-class.html#enabled"><a title="getargs.Arg.enabled" class="py-name" href="#" onclick="return doclink('link-42', 'enabled', 'link-42');">enabled</a></tt><tt class="py-op">=</tt><tt class="py-name">checked</tt> </tt>
</div><a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">    <tt class="py-comment">#To ensure uri's work...</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">basename</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">!=</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">chdir</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">optparse</tt><tt class="py-op">,</tt><tt id="link-43" class="py-name" targets="Module icons=icons-module.html"><a title="icons" class="py-name" href="#" onclick="return doclink('link-43', 'icons', 'link-43');">icons</a></tt><tt class="py-op">,</tt><tt id="link-44" class="py-name" targets="Module getargs=getargs-module.html"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-44', 'getargs', 'link-44');">getargs</a></tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">     </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">    <tt class="py-name">APP</tt><tt class="py-op">=</tt><tt class="py-string">'MetaGETA Transforms'</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">    <tt class="py-name">ICON</tt><tt class="py-op">=</tt><tt id="link-45" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-45', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-46" class="py-name" targets="Class icons.app_img=icons.app_img-class.html"><a title="icons.app_img" class="py-name" href="#" onclick="return doclink('link-46', 'app_img', 'link-46');">app_img</a></tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">    <tt class="py-name">description</tt><tt class="py-op">=</tt><tt class="py-string">'Transform metadata to XML'</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">    <tt class="py-name">parser</tt> <tt class="py-op">=</tt> <tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">OptionParser</tt><tt class="py-op">(</tt><tt class="py-name">description</tt><tt class="py-op">=</tt><tt class="py-name">description</tt><tt class="py-op">)</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-x"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"xls"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"xls"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Excel spreadsheet"</tt><tt class="py-op">)</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">    <tt class="py-name">xlsarg</tt><tt class="py-op">=</tt><tt id="link-47" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-47', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-48" class="py-name" targets="Class getargs.FileArg=getargs.FileArg-class.html"><a title="getargs.FileArg" class="py-name" href="#" onclick="return doclink('link-48', 'FileArg', 'link-48');">FileArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">filter</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">(</tt><tt class="py-string">'Excel Spreadsheet'</tt><tt class="py-op">,</tt><tt class="py-string">'*.xls'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-49" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-49', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-50" class="py-name" targets="Class icons.xls_img=icons.xls_img-class.html"><a title="icons.xls_img" class="py-name" href="#" onclick="return doclink('link-50', 'xls_img', 'link-50');">xls_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">    <tt class="py-name">xlsarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">"Excel spreadsheet to read metadata from."</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">'-d'</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"dir"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"dir"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">'Output directory'</tt><tt class="py-op">)</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-51" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-51', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-52" class="py-name" targets="Class icons.dir_img=icons.dir_img-class.html"><a title="icons.dir_img" class="py-name" href="#" onclick="return doclink('link-52', 'dir_img', 'link-52');">dir_img</a></tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">    <tt class="py-name">dirarg</tt><tt class="py-op">=</tt><tt id="link-53" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-53', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-54" class="py-name" targets="Class getargs.DirArg=getargs.DirArg-class.html"><a title="getargs.DirArg" class="py-name" href="#" onclick="return doclink('link-54', 'DirArg', 'link-54');">DirArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">initialdir</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt id="link-55" class="py-name"><a title="getargs.Arg.enabled" class="py-name" href="#" onclick="return doclink('link-55', 'enabled', 'link-42');">enabled</a></tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-56" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-56', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="icons.dir_img" class="py-name" href="#" onclick="return doclink('link-57', 'dir_img', 'link-52');">dir_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">    <tt class="py-name">dirarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">'The directory to output metadata XML to.'</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">     </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-t"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"xsl"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"xsl"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"XSL transform"</tt><tt class="py-op">)</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">=</tt><tt id="link-58" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-58', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-59" class="py-name" targets="Class getargs.ComboBoxArg=getargs.ComboBoxArg-class.html"><a title="getargs.ComboBoxArg" class="py-name" href="#" onclick="return doclink('link-59', 'ComboBoxArg', 'link-59');">ComboBoxArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-60" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-60', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-61" class="py-name" targets="Class icons.xsl_img=icons.xsl_img-class.html"><a title="icons.xsl_img" class="py-name" href="#" onclick="return doclink('link-61', 'xsl_img', 'link-61');">xsl_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">"XSL transform {*.xsl|%s}."</tt> <tt class="py-op">%</tt> <tt class="py-string">'|'</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">'"%s"'</tt><tt class="py-op">%</tt><tt id="link-62" class="py-name"><a title="transforms.s" class="py-name" href="#" onclick="return doclink('link-62', 's', 'link-3');">s</a></tt> <tt class="py-keyword">for</tt> <tt id="link-63" class="py-name"><a title="transforms.s" class="py-name" href="#" onclick="return doclink('link-63', 's', 'link-3');">s</a></tt> <tt class="py-keyword">in</tt> <tt id="link-64" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-64', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-65" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-65', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">.</tt><tt class="py-name">options</tt><tt class="py-op">=</tt><tt id="link-66" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-66', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-67" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-67', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-m"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"mef"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">                     <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Create Metadata Exchange Format (MEF) file"</tt><tt class="py-op">)</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">    <tt class="py-name">mefarg</tt><tt class="py-op">=</tt><tt id="link-68" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-68', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-69" class="py-name" targets="Class getargs.BoolArg=getargs.BoolArg-class.html"><a title="getargs.BoolArg" class="py-name" href="#" onclick="return doclink('link-69', 'BoolArg', 'link-69');">BoolArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-70" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-70', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-71" class="py-name"><a title="icons.xsl_img" class="py-name" href="#" onclick="return doclink('link-71', 'xsl_img', 'link-61');">xsl_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">    <tt class="py-name">mefarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">help</tt><tt class="py-op">+</tt><tt class="py-string">'?'</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-c"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"cat"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"cat"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt id="link-72" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-72', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Variable transforms.categories=transforms-module.html#categories"><a title="transforms.categories" class="py-name" href="#" onclick="return doclink('link-73', 'categories', 'link-73');">categories</a></tt><tt class="py-op">[</tt><tt class="py-string">'default'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt>    </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">                     <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Dataset category"</tt><tt class="py-op">)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">    <tt class="py-name">catarg</tt><tt class="py-op">=</tt><tt id="link-74" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-74', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="getargs.ComboBoxArg" class="py-name" href="#" onclick="return doclink('link-75', 'ComboBoxArg', 'link-59');">ComboBoxArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt id="link-76" class="py-name"><a title="getargs.Arg.enabled" class="py-name" href="#" onclick="return doclink('link-76', 'enabled', 'link-42');">enabled</a></tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-name">multiselect</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-77" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-77', 'icons', 'link-43');">icons</a></tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="icons.xsl_img" class="py-name" href="#" onclick="return doclink('link-78', 'xsl_img', 'link-61');">xsl_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">    <tt class="py-name">catarg</tt><tt class="py-op">.</tt><tt class="py-name">options</tt><tt class="py-op">=</tt><tt id="link-79" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-79', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="transforms.categories" class="py-name" href="#" onclick="return doclink('link-80', 'categories', 'link-73');">categories</a></tt><tt class="py-op">[</tt><tt class="py-string">'categories'</tt><tt class="py-op">]</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">    <tt class="py-name">catarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">'Dataset category for Metadata Exchange Format (MEF) file. Default is "%s". If a "category" column exists in the spreadsheet, values from that column will override any selection here.'</tt><tt class="py-op">%</tt><tt id="link-81" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-81', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-82" class="py-name"><a title="transforms.categories" class="py-name" href="#" onclick="return doclink('link-82', 'categories', 'link-73');">categories</a></tt><tt class="py-op">[</tt><tt class="py-string">'default'</tt><tt class="py-op">]</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">    <tt class="py-name">mefarg</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="getargs.Arg.callback
getargs.GetArgs.callback" class="py-name" href="#" onclick="return doclink('link-83', 'callback', 'link-34');">callback</a></tt><tt class="py-op">=</tt><tt id="link-84" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-84', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-85" class="py-name" targets="Class getargs.Command=getargs.Command-class.html"><a title="getargs.Command" class="py-name" href="#" onclick="return doclink('link-85', 'Command', 'link-85');">Command</a></tt><tt class="py-op">(</tt><tt class="py-name">mefcallback</tt><tt class="py-op">,</tt><tt class="py-name">mefarg</tt><tt class="py-op">,</tt><tt class="py-name">catarg</tt><tt class="py-op">)</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">     </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--keep-alive"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"keepalive"</tt><tt class="py-op">,</tt> <tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Keep this dialog box open"</tt><tt class="py-op">)</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">    <tt class="py-name">kaarg</tt><tt class="py-op">=</tt><tt id="link-86" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-86', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-87" class="py-name"><a title="getargs.BoolArg" class="py-name" href="#" onclick="return doclink('link-87', 'BoolArg', 'link-69');">BoolArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">)</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">    <tt class="py-name">kaarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">'Do you want to keep this dialog box open after running the metadata transform so you can run another?'</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--debug"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"debug"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Turn debug output on"</tt><tt class="py-op">)</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-l"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"log"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"log"</tt><tt class="py-op">,</tt>                             </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">                      <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">SUPPRESS_HELP</tt><tt class="py-op">)</tt> <tt class="py-comment">#help="Log file")                     #Not yet implemented</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--nogui"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"nogui"</tt><tt class="py-op">,</tt> <tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Disable the GUI progress dialog"</tt><tt class="py-op">)</tt>  </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">    <tt class="py-name">optvals</tt><tt class="py-op">,</tt><tt class="py-name">argvals</tt> <tt class="py-op">=</tt> <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">parse_args</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line"> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">    <tt class="py-name">logger</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">    <tt class="py-name">forceexit</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">    <tt class="py-comment">#Do we need to pop up the GUI?</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">:</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">        <tt class="py-comment">#Add existing command line args values to opt default values so they show in the gui</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">opt</tt> <tt class="py-keyword">in</tt> <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">option_list</tt><tt class="py-op">:</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">            <tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">vars</tt><tt class="py-op">(</tt><tt class="py-name">optvals</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">dest</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">        <tt class="py-comment">#Pop up the GUI</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">        <tt class="py-name">keepalive</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">keepalive</tt><tt class="py-op">:</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">            <tt class="py-name">args</tt><tt class="py-op">=</tt><tt id="link-88" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-88', 'getargs', 'link-44');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-89" class="py-name" targets="Class getargs.GetArgs=getargs.GetArgs-class.html"><a title="getargs.GetArgs" class="py-name" href="#" onclick="return doclink('link-89', 'GetArgs', 'link-89');">GetArgs</a></tt><tt class="py-op">(</tt><tt class="py-name">xlsarg</tt><tt class="py-op">,</tt><tt class="py-name">dirarg</tt><tt class="py-op">,</tt><tt class="py-name">xslarg</tt><tt class="py-op">,</tt><tt class="py-name">mefarg</tt><tt class="py-op">,</tt><tt class="py-name">catarg</tt><tt class="py-op">,</tt><tt class="py-name">kaarg</tt><tt class="py-op">,</tt><tt class="py-name">title</tt><tt class="py-op">=</tt><tt class="py-name">APP</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt class="py-name">ICON</tt><tt class="py-op">)</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">args</tt><tt class="py-op">:</tt><tt class="py-comment">#GetArgs returns None if user cancels the GUI</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">logger</tt> <tt class="py-keyword">and</tt> <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt class="py-name">logging</tt><tt class="py-op">:</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">                    <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Method progresslogger.ProgressLoggerHandler.resetProgress()=progresslogger.ProgressLoggerHandler-class.html#resetProgress"><a title="progresslogger.ProgressLoggerHandler.resetProgress" class="py-name" href="#" onclick="return doclink('link-90', 'resetProgress', 'link-90');">resetProgress</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">                    <tt class="py-name">logger</tt><tt class="py-op">=</tt><tt id="link-91" class="py-name" targets="Function runcrawler.getlogger()=runcrawler-module.html#getlogger,Function runtransform.getlogger()=runtransform-module.html#getlogger"><a title="runcrawler.getlogger
runtransform.getlogger" class="py-name" href="#" onclick="return doclink('link-91', 'getlogger', 'link-91');">getlogger</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">=</tt><tt class="py-name">APP</tt><tt class="py-op">,</tt><tt class="py-name">nogui</tt><tt class="py-op">=</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">nogui</tt><tt class="py-op">,</tt> <tt id="link-92" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-92', 'debug', 'link-22');">debug</a></tt><tt class="py-op">=</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-93', 'debug', 'link-22');">debug</a></tt><tt class="py-op">,</tt> <tt class="py-name">icon</tt><tt class="py-op">=</tt><tt class="py-name">ICON</tt><tt class="py-op">)</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">                <tt class="py-name">keepalive</tt><tt class="py-op">=</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">keepalive</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">                <tt class="py-name">forceexit</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">                <tt id="link-94" class="py-name" targets="Function runcrawler.main()=runcrawler-module.html#main,Function runtransform.main()=runtransform-module.html#main"><a title="runcrawler.main
runtransform.main" class="py-name" href="#" onclick="return doclink('link-94', 'main', 'link-94');">main</a></tt><tt class="py-op">(</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">logger</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">mef</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">cat</tt><tt class="py-op">)</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">                <tt class="py-name">forceexit</tt><tt class="py-op">=</tt><tt class="py-name">False</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt><tt class="py-name">keepalive</tt><tt class="py-op">=</tt><tt class="py-name">False</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-comment">#No need for the GUI</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt class="py-name">logger</tt><tt class="py-op">=</tt><tt id="link-95" class="py-name"><a title="runcrawler.getlogger
runtransform.getlogger" class="py-name" href="#" onclick="return doclink('link-95', 'getlogger', 'link-91');">getlogger</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">=</tt><tt class="py-name">APP</tt><tt class="py-op">,</tt><tt class="py-name">nogui</tt><tt class="py-op">=</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">nogui</tt><tt class="py-op">,</tt> <tt id="link-96" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-96', 'debug', 'link-22');">debug</a></tt><tt class="py-op">=</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt id="link-97" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-97', 'debug', 'link-22');">debug</a></tt><tt class="py-op">,</tt> <tt class="py-name">icon</tt><tt class="py-op">=</tt><tt class="py-name">ICON</tt><tt class="py-op">)</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">        <tt id="link-98" class="py-name"><a title="runcrawler.main
runtransform.main" class="py-name" href="#" onclick="return doclink('link-98', 'main', 'link-94');">main</a></tt><tt class="py-op">(</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">logger</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">mef</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">cat</tt><tt class="py-op">)</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">logger</tt><tt class="py-op">:</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">        <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name" targets="Method progresslogger.ProgressLogger.shutdown()=progresslogger.ProgressLogger-class.html#shutdown"><a title="progresslogger.ProgressLogger.shutdown" class="py-name" href="#" onclick="return doclink('link-99', 'shutdown', 'link-99');">shutdown</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">        <tt class="py-keyword">del</tt> <tt class="py-name">logger</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >MetaGETA (Metadata Gathering, Extraction and Transformation)</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    &nbsp;
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
